<template>
  <div>
    <el-button type="primary" size="small" @click="dialogFormVisible = true" class="margin">添加</el-button>
    <el-dialog title="添加人员" :visible.sync="dialogFormVisible">
      <el-form :model="form" class="pad">
        <el-form-item label="用户名" :label-width="formLabelWidth">
          <el-input size="small" v-model="form.name" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="手机号码" :label-width="formLabelWidth">
          <el-input size="small" v-model="form.tele" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="密码" :label-width="formLabelWidth">
          <el-input size="small" v-model="form.password" autocomplete="off"></el-input>
        </el-form-item>
        <el-form-item label="确认密码" :label-width="formLabelWidth">
          <el-input size="small" v-model="form.repassword" autocomplete="off"></el-input>
        </el-form-item>
      </el-form>
      <div slot="footer" class="dialog-footer pad">
        <el-button @click="dialogFormVisible = false">取 消</el-button>
        <el-button type="primary" @click="post_user_info($event)">
          <span @click="dialogFormVisible = false">提交</span>
        </el-button>
      </div>
    </el-dialog>
  </div>
</template>

<script>
import request from '@/plugin/axios'
export default {
  name: 'addAdminUser',
  data () {
    return {
      dialogFormVisible: false,
      form: {
        name: '',
        tele: '',
        password: '',
        repassword: '',
        delivery: false,
        type: []
      },
      formLabelWidth: '120px'
    }
  },
  methods: {
    post_user_info (form) {
      var data
      data = { name: this.form.name, tele: this.form.tele, password: this.form.password }
      request({
        url: 'reception/adminUsers/postuser',
        method: 'post',
        data
      }).then(function (res) {
        alert('提交成功')
        console.log(res)
      })
    }
  }
}
</script>

<style>
.margin {
  margin-right: 20px;
}
.pad {
  padding-right: 20px;
}
</style>
